using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace WindowsPhoneTron.Graphic
{
    class Unit
    {
        Vector2 position;
        Vector2 spriteOrigin;
        Texture2D bikeSprite;
        int pixelsMoved = 0; // Used to determine when exactly a bike has moved precisely one tile
        
        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
        }

        public int PixelsMoved
        {
            get { return pixelsMoved; }
            set { pixelsMoved = value; }
        }

        public Unit(GraphicsDevice device, Vector2 position, Texture2D sprite)
        {
            this.position = position;
            bikeSprite = sprite;
            spriteOrigin.X = (float)bikeSprite.Width / 2.0f;
            spriteOrigin.Y = (float)bikeSprite.Height / 2.0f;
        }

        public void Draw(SpriteBatch batch, float direction)
        {
            batch.Draw(bikeSprite, position, null, Color.White, direction, spriteOrigin, 1.0f, SpriteEffects.None, 0.0f);
        }
    }
}
